<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"></meta>
    <title>usercontent</title>
</head>
<body>
<usercontent th:fragment="usercontent">
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1>用户管理</h1>
                    </div>
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                            <li class="breadcrumb-item"><a href="index">Home</a></li>
                            <li class="breadcrumb-item active">管理面板/用户管理</li>
                            <div class="tipmsg" style="display: none">

                            </div>
                        </ol>
                    </div>
                </div>
            </div><!-- /.container-fluid -->
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                <div class="table-responsive">
                                    <table class="table table-striped text-nowrap">
                                        <tr>
                                            <th>ID</th>
                                            <th>头像</th>
                                            <th>用户名</th>
                                            <th>邮箱</th>
                                            <th>仓库使用情况</th>
                                            <th>注册时间</th>
                                            <th>上传权限</th>
                                            <th>仓库容量(MB)</th>
                                            <th>操作</th>
                                        </tr>
                                        <tr th:each="user:${users}">
                                            <td th:text="${user.userId}"></td>
                                            <td>
                                                <img alt="image" th:src="${user.imagePath}" class="rounded-circle"
                                                     width="25" data-toggle="title" title="Wildan Ahdian">
                                            </td>
                                            <td th:text="${user.userName}"></td>
                                            <td th:text="${user.email}"></td>
                                            <td class="align-middle">
                                                <div class="progress" style="height: 4px;" data-toggle="tooltip"
                                                     th:title="${user.current + '%'}">
                                                    <div class="progress-bar bg-success"
                                                         th:style="'width:'+ ${user.current + '%'}"></div>
                                                </div>
                                            </td>
                                            <td th:text="${#dates.format(user.registerTime,'yyyy-MM-dd HH:mm')}"></td>
                                            <td>
                                                <select th:id="${'permission'+user.userId}">
                                                    <option value="0" th:if="${user.permission == 0}" checked>允许上传下载
                                                    </option>
                                                    <option value="1" th:if="${user.permission == 1}" checked>只允许下载
                                                    </option>
                                                    <option value="2" th:if="${user.permission == 2}" checked>禁止上传下载
                                                    </option>
                                                    <option value="0" th:if="${user.permission != 0}">允许上传下载</option>
                                                    <option value="1" th:if="${user.permission != 1}">只允许下载</option>
                                                    <option value="2" th:if="${user.permission != 2}">禁止上传下载</option>
                                                </select>
                                            </td>
                                            <td>
                                                <input th:id="${'size'+user.userId}" type="number" min="1024"
                                                       th:value="${user.maxSize/1024}">
                                            </td>
                                            <td>
                                                <a th:href="'javaScript:updateStore('+${user.userId}+')'"
                                                   class="btn-sm btn-success">更新</a>
                                                <a th:href="@{/deleteUser(cur=${page.getPageNum()},uId=${user.userId})}"
                                                   class="btn-sm btn-danger">删除</a>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.row -->
            </div>
            <div class="row">
                <div class="col-12">
                    <div class="zxf_pagediv"></div>
                </div>
            </div>
            <div id="pageNum" style="display: none">[[${page.getPages()}]]</div>
            <div id="current" style="display: none">[[${page.getPageNum()}]]</div>
            <!-- /.container-fluid -->
        </section>
        <!-- /.content -->
    </div>
</usercontent>
</body>
</html>